/**************************************************************
*
* M3D_LINE.H
*
* Lines & Line Segments
**************************************************************/

//
// Lines & Points qualifications
//
extern int  m2dQualPointLine_A   (const m2dV *v, const m2dV *lB, const m2dV *lE, float accuracy);
extern int  m2dQualPointLine_S   (const m2dV *v, const m2dV *lB, const m2dV *lE, float accuracy);
extern int  m3xzQualPointLine_A  (const m3dV *v, const m3dV *lB, const m3dV *lE, float accuracy);
extern int  m3yzQualPointLine_A  (const m3dV *v, const m3dV *lB, const m3dV *lE, float accuracy);
extern int  r2xyQualPointLine_A  (const m3dV *v, const m3dV *lB, const m3dV *lE, float accuracy);

#define m2dQualPointLine(v,lB,lE)   m2dQualPointLine_A (v,lB,lE,M3D_EPSILON)
#define m3xzQualPointLine(v,lB,lE)  m3xzQualPointLine_A(v,lB,lE,M3D_EPSILON)
#define m3yzQualPointLine(v,lB,lE)  m3yzQualPointLine_A(v,lB,lE,M3D_EPSILON)
#define m3xyQualPointLine(v,lB,lE)  m3xyQualPointLine_A(v,lB,lE,M3D_EPSILON)

//
// Distances between points and lines
//
extern BOOL  m3xzDistPointLSeg    (m3dV *point, m3dV *lB, m3dV *lE, float distAlpha,   float *dist,   m3dV *vClosest = NULL);
extern BOOL  m3xzDistPointLSeg_2  (m3dV *point, m3dV *lB, m3dV *lE, float distAlpha_2, float *dist_2, m3dV *vClosest = NULL);
extern float m2dDistPointLine     (const m2dV *point, const m2dV *lB, const m2dV *lE);
extern float m2dDistPointLine_S   (m2dV *point, m2dV *lB, m2dV *lE);
extern float m2dDistPointLSeg     (m2dV *point, m2dV *lB, m2dV *lE, m2dV *vClosest = NULL, float *tMin = NULL);
extern float m2dDistPointLSeg_2   (m2dV *point, m2dV *lB, m2dV *lE, m2dV *vClosest, float *tMin);
extern float m3dDistPointLine     (const m3dV *point, const m3dV *lB, const m3dV *lE);
extern float m3dDistPointLine     (const m3dV *point, const m3dV *lB, const m3dV *lE, m3dV *vClosest);
extern float m3dDistPointLSeg     (const m3dV *point, m3dV *lB, m3dV *lE, m3dV *vClosest = NULL);
extern BOOL  m3dDistPointLSeg     (const m3dV *point, m3dV *lB, m3dV *lE, float distAlpha, float *dist, m3dV *vClosest = NULL, float *tMin = NULL);

extern float m3dDistLineLine      (m3dV *lB1, m3dV *lE1, m3dV *lB2, m3dV *lE2);
extern BOOL  m3dDistLSegLSeg      (m3dV *lB1, m3dV *lE1, m3dV *lB2, m3dV *lE2, float distMax, float *dist, m3dV *vClos1, m3dV *vClos2);

//
// Lines intersections
//
extern BOOL m2dIsectLineLine         (m2dV *v1, m2dV *v2,m2dV *lB, m2dV *lE, m2dV *v);
extern BOOL m2dIsectLSegLSeg         (m2dV *v1, m2dV *v2, m2dV *lB, m2dV *lE, m2dV *v);
extern BOOL m3xzIsectLSegLSeg        (m3dV *v1, m3dV *v2, m3dV *lB, m3dV *lE, m3dV *v);
extern BOOL m2dIsectLSegPolyBoundary (m2dV *v1, m2dV *v2, int nPoints, m2dV *poly, m2dV *vOut);
extern BOOL m3xzIsectLineLine        (m3dV *v1, m3dV *v2, m3dV *lB, m3dV *lE, m3dV *v);
extern BOOL m3dIsectLineLine_A       (m3dV *v1, m3dV *v2, m3dV *lB, m3dV *lE, m3dV *v, float accuracy);
extern BOOL m3dIsIsectYLinePlane     (m3dV *pLineOrg, m3dV *pPlaneOrg, m3dV *pPlaneNormal, m3dV *pIsect);
extern BOOL m3dIsectLineLine         (m3dV *l1, m3dV *l2, m3dV *v1, m3dV *v2, m3dV *v);
extern BOOL m3dIsectLineLSeg         (m3dV *l1, m3dV *l2, m3dV *lb, m3dV *le, m3dV *v);

//
// End-of-file M3D_LINE.H
//
